<template>
  <div id="app">
    <el-container>
      <el-header>
    <router-view name="nav"></router-view>
      </el-header>
      <div class="container">
        <el-main>
          <router-view name="body"></router-view>
          <music></music>
        </el-main>
      </div>
      <transition
              name="tran_rank"
              enter-active-class="animated fadeIn"
              leave-active-class="animated fadeOut"
      >
      <div class="page-up" v-if="flag">
        <a @click="toTop()" class="arctic_scroll"><i class="el-icon-caret-top"></i></a>
      </div>
      </transition>
      <el-footer>
    <router-view name="foot"></router-view>
      </el-footer>
    </el-container>
  </div>
</template>

<script>
import {getScrollTop,addEvent,buildParams} from '@/assets/js/util.js'
import music from '@/components/music'
export default {
  name: 'app',
    data () {
        return {
            flag:true,
        }
    },
    methods:{
        pageUP:function () {
            if(getScrollTop()>60&&this.flag == false){
                //let eles = document.getElementsByClassName('page-up')
                //eles[0].classList.add('show')
                this.flag = true
            }else if(getScrollTop()<60&&this.flag == true){
                //let eles = document.getElementsByClassName('page-up')
                //eles[0].classList.remove('show')
                this.flag = false
            }
        },
        toTop:function () {
            $('html,body').animate({
                    scrollTop:"0px"},
                666
            )
        }
    },
    components:{
      'music':music
    },
    mounted:function () {
        addEvent(window,'scroll',this.pageUP)
    }
}
</script>

<style>
  body {
    margin: 0;
    background-color: #f3f2f0;
    background: url("/static/img/background/back01.png") no-repeat fixed center;
  }
  .el-header{
    padding: inherit !important;
  }
  .el-main{
    padding: inherit !important;
  }
  .el-footer{
    padding: inherit !important;
  }
  .page-up{
    background-color: #fff;
    position: fixed;
    right: 20px;
    bottom: 100px;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    cursor: pointer;
    transition: .3s;
    box-shadow: 0 0 6px rgba(0,0,0,.12);
  }
  .page-up i {
    color: #409eff;
    display: block;
    line-height: 40px;
    text-align: center;
    font-size: 18px;
  }
  .arctic_scroll{
    text-decoration: none;
  }
  .right{
    float: right !important;
  }
  .left{
    float: left !important;
  }
  #app{
  }
</style>
